angular.module('app-router', ['ui.router'])

.config ($stateProvider, $urlRouterProvider) ->
    $stateProvider
    .state('tab',
        url: '/tab/wechat'
        template: '<ion-nav-view></ion-nav-view>'
        abstract: true
    )

    .state('tab.myself',
        url: '/myself'
        templateUrl: 'templates/pages/tab-myself/tab-myself.html'
        controller: 'TabMyselfCtrl'
        cache:false
    )

    .state('tab.home',
        url: '/home'
        templateUrl: 'templates/pages/tab-home/tab-home.html'
        controller: 'TabHomeCtrl'
        cache:false
    )

    .state('login',
        url: '/login'
        templateUrl: 'templates/pages/login/login.html'
        controller: 'LoginCtrl'
        cache:false
    )

    .state('tab.orderDetail',
        url: '/tab-orderDetail/{id}'
        templateUrl: 'templates/pages/tab-orderDetail/tab-orderDetail.html'
        controller: "OrderDetailCtrl"
        cache:false
        params:
            id: 0
    )

    .state('tab.myinfo',
        url: '/tab-myinfo'
        templateUrl: 'templates/pages/tab-myinfo/tab-myinfo.html'
        controller: "TabMyinfoCtrl"
        cache:false
    )

    .state('tab.order-list',
        url: '/tab-order-list'
        templateUrl: 'templates/pages/tab-order-list/tab-order-list.html'
        controller: "TabOrderListCtrl"
        cache:false
    )

    .state('tab.income',
        url: '/income'
        templateUrl: 'templates/pages/tab-income/tab-income.html'
        controller: "IncomeCtrl"
        cache:false
    )

    .state('tab.makeorder',
        url: '/makeorder'
        templateUrl: 'templates/pages/tab-makeorder/tab-makeorder.html'
        controller: "TabMakeorderCtrl"
        cache:false
    )

    $urlRouterProvider.otherwise '/login'
